// 云函数入口文件
const cloud = require('wx-server-sdk')
cloud.init({
    env: "cloudwx-dm78q"
})
DB = cloud.database().collection("product");

cloud.init()

// 云函数入口函数
exports.main = async (event, context) => {


    return DB.add({
        // newData 字段表示需新增的 JSON 数据
        data: {
            number: event.newData.number,
            name: event.newData.name,
            picurl: event.newData.picurl,
            store: event.newData.store,
            productTypeId: event.newData.productTypeId,
            productTypeName: event.newData.productTypeName,
            qr: event.newData.qr,
            memo: event.newData.memo,
            price:event.newData.price,
          stepCount: event.newData.stepCount
        }
    })
        .then(res => {
            console.log(res);
        })
        .catch(console.error)


}